package com.nur.noteishon;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Spinner;

public class StartActivity extends Activity implements OnClickListener {

	private Spinner listaTipoNotas;
	CustomDatePicker pickerInicio;
	CustomDatePicker pickerFin;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_start);
		pickerInicio = (CustomDatePicker) findViewById(R.id.searchFechaInicio);
		pickerInicio.setParent(this);

		pickerFin = (CustomDatePicker) findViewById(R.id.searchFechaFin);
		pickerFin.setParent(this);

		listaTipoNotas = (Spinner) findViewById(R.id.spinnerTipoNotas);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_start, menu);
		return true;
	}

	public void onClick(View v) {
		if (v.getId() == R.id.btnBuscar) {
			Intent intentLista = new Intent(getBaseContext(), ListaNotas.class);
			intentLista.putExtra("com.nur.noteishon.fechaInicio",
					pickerInicio.getSelectedDate());
			intentLista.putExtra("com.nur.noteishon.fechaFin",
					pickerInicio.getSelectedDate());
			intentLista.putExtra("com.nur.noteishon.tipoNota", listaTipoNotas
					.getSelectedItem().toString());
			startActivity(intentLista);
		}
	}
}
